package xyz.heyaoshare.core.controller.system.menu.vo.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import xyz.heyaoshare.core.enums.system.menu.MenuOpenStyleEnum;
import xyz.heyaoshare.core.enums.system.menu.MenuTypeEnum;
import xyz.heyaoshare.validation.validator.InEnum;

import java.io.Serial;
import java.io.Serializable;

import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;

/**
 * 更新菜单请求对象
 * @author YueHe
 * @version 0.0.1
 * @since 2025/5/9 下午4:33
 */
@Data
@Schema(description = "更新菜单请求对象")
public class MenuUpdateReqVO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "菜单ID不能为空")
    @Schema(description = "菜单ID", requiredMode = REQUIRED)
    private Long id;

    @Schema(description = "父级菜单ID")
    private Long parentId;

    @Length(max = 50, message = "菜单名称长度不能超过{max}字符")
    @NotBlank(message = "菜单名称不能为空")
    @Schema(description = "菜单名称", requiredMode = REQUIRED)
    private String name;

    @Length(max = 100, message = "菜单URL长度不能超过{max}字符")
    @Schema(description = "菜单URL")
    private String url;

    @Length(max = 300, message = "授权标识长度不能超过{max}字符")
    @Schema(description = "授权标识【多个用英文逗号分隔】")
    private String authority;

    @NotNull(message = "菜单类型不能为空")
    @InEnum(value = MenuTypeEnum.class, message = "菜单类型错误")
    @Schema(description = "菜单类型", requiredMode = REQUIRED)
    private Integer type;

    @NotNull(message = "打开方式不能为空")
    @InEnum(value = MenuOpenStyleEnum.class, message = "打开方式错误")
    @Schema(description = "打开方式", requiredMode = REQUIRED)
    private Integer openStyle;

    @Length(max = 50, message = "图标长度不能超过{max}字符")
    @Schema(description = "图标")
    private String icon;

    @Schema(description = "菜单排序")
    private Integer sort;

}